package com.api.shopapi.service.impl;


import com.api.shopapi.entity.RoleMenuRel;
import com.api.shopapi.mapper.RoleMenuRelMapper;
import com.api.shopapi.service.RoleMenuRelService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("RoleMenuRelServiceImplOne")
public class RoleMenuRelServiceImpl implements RoleMenuRelService {

    @Autowired
    private RoleMenuRelMapper roleMenuRelMapper;



    @Override
    public int insert(RoleMenuRel roleMenuRel){
        return roleMenuRelMapper.insert(roleMenuRel);
    }

    @Override
    public int deleteByRoleMenuRelCode(String roleMenuRelCode){
        return roleMenuRelMapper.deleteByRoleMenuRelCode(roleMenuRelCode);
    }

    @Override
    public int updateByRoleMenuRelCode(RoleMenuRel roleMenuRel){
        return roleMenuRelMapper.updateByRoleMenuRelCode(roleMenuRel);
    }

    @Override
    public RoleMenuRel getByRoleMenuRelCode(String roleMenuRelCode){
        return roleMenuRelMapper.getByRoleMenuRelCode(roleMenuRelCode);
    }

    @Override
    public List<RoleMenuRel> getList() {
        return roleMenuRelMapper.getList();
    }

    @Override
    public List<RoleMenuRel> getListByRoleCode(String roleCode){
        return roleMenuRelMapper.getListByRoleCode(roleCode);
    }

    @Override
    public PageInfo<RoleMenuRel> getPageInfo(int pageNum, int pageSize){
        PageHelper.startPage(pageNum, pageSize);
        List<RoleMenuRel> listRoleMenuRel = roleMenuRelMapper.getList();
        PageInfo<RoleMenuRel> pageInfo = new PageInfo<RoleMenuRel>(listRoleMenuRel);
        return pageInfo;
    }


}
